{% extends 'envs_python/layout_envs_python.html' %}

{% block page_content %}
{{ block.super }}
<div class="card">
    <div class="card-header">
        <div class="card-title">
             <a href="{% url app_namespace|add:':package_install' version %}" class="btn btn-success">
                 <i class="fa fa-plus"></i> 包安装
             </a>
        </div>
        <div class="card-tools">
{#            <a href="" class="btn btn-outline-info"><i class="fa fa-file-export"></i> 导出包列表</a>#}
        </div>
    </div>
    <div class="card-body">
<dl class="row">
    <dt class="col-sm-1">环境名称</dt><dd class="col-sm-11">{{ env_info.name }}</dd>
    <dt class="col-sm-1">版本</dt><dd class="col-sm-11">{{ env_info.version }}</dd>
    <dt class="col-sm-1">路径</dt><dd class="col-sm-11">{{ env_info.folder }}</dd>
</dl>
    <hr/>
    {% include 'include_messages.html' %}
        <table class="table table-hover table-striped">
            <thead>
            <tr>
                <th>名称</th>
                <th>PYPI页</th>
                <th>当前版本</th>
                <th>最新版本</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
                {% for name, package in packages.items %}
                <tr>
                    <td>{{ package.name }}</td>
                    <td>
<a href="https://pypi.org/project/{{ package.name }}/{{ package.current_version }}/" target="_blank" class="text-primary" title="查阅PYPI上当前包的主页详情">
    <i class="fas fa-globe"></i>
</a>
                    </td>
                    <td>{{ package.current_version }}</td>
                    <td>
{% if package.latest_version %}
   {{ package.latest_version }}
    <a href="{% url app_namespace|add:':package_upgrade' version name %}" title="升级" onclick="return confirm('确定要尝试升级吗？');">
        <i class="fas fa-upload"></i>
    </a>
{% else %} - {% endif %}
                    </td>
                    <td>
{% if name == 'pip' or name == 'setuptools' or name == 'wheel' %}-{% else %}
    <a href="{% url app_namespace|add:':package_uninstall' version %}?package={{ package.name }}" class="btn btn-outline-info btn-xs">卸载</a>
{% endif %}
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}